home *** CD-ROM | disk | FTP | other *** search
Modula Implementation | 1996-06-21 | 3.0 KB | 95 lines | [TEXT/MEDT] |
- IMPLEMENTATION MODULE DMHeapWatch ;
-
- (*
-
- Implementation and Revisions:
- ============================
-
- Author Date Description
- ------ ---- -----------
-
- af 02/02/90 First implementation (DM 2.0, MacMETH 2.6+)
- af 26/10/90 showLevels added
- af/dg 05/11/90 allocInfoProc, deallocInfoProc added
- af 20/11/90 InstallTermProc now from DMLevels used
- dg 14/02/92 DM V2.2, MacMETH V3.2
- --- END OF MODULE HISTORY --- *)
-
-
- FROM SYSTEM IMPORT ADDRESS;
- FROM DMLevels IMPORT curDMLevel, startUpLevel, InstallTermProc;
-
- FROM DMDebugHelp IMPORT MessageWindow, WriteString, WriteLn,
- WriteInt, Message, lastModuleID;
-
-
-
- VAR
- initTermDone: BOOLEAN;
- i: INTEGER;
-
- PROCEDURE WriteHeapNotCleanMsgs;
- BEGIN
- WriteString("Errors detected by AtTermDM: not all heap released:"); WriteLn;
- WriteLn;
- WriteString(" ptrCount = "); WriteInt( ptrCount, 0); WriteLn;
- WriteString(" handleCount = "); WriteInt( handleCount, 0); WriteLn;
- WriteString(" windowCount = "); WriteInt( windowCount, 0); WriteLn;
- WriteString(" TECount = "); WriteInt( TECount, 0); WriteLn;
- WriteString(" controlCount = "); WriteInt( controlCount,0); WriteLn;
- WriteString(" menuCount = "); WriteInt( menuCount, 0); WriteLn;
- WriteString(" dialogCount = "); WriteInt( dialogCount, 0); WriteLn;
- WriteLn;
- WriteString("Please report the values <> 0 shown here together with a ");
- WriteLn;
- WriteString("brief description of your program (e.g. which DM modules used etc.) ");
- WriteLn;
- WriteString("to the developers of the 'Dialog Machine' at ETH Zürich, Switzerland.");
- WriteLn;
- WriteString("Thanks for your help and cooperation!"); WriteLn;
- END WriteHeapNotCleanMsgs;
-
-
- PROCEDURE AtTermDM;
- BEGIN
- IF (curDMLevel = startUpLevel) AND (
- (handleCount<>0) OR (windowCount<>0) OR (TECount<>0)
- OR (controlCount<>0) OR (menuCount<>0) OR (dialogCount<>0) )
- THEN
- (* ("Not all heap returned") *)
- MessageWindow(10,40,480,300,WriteHeapNotCleanMsgs);
- END;
- END AtTermDM;
-
-
- PROCEDURE DoNotShowLevels (s: ARRAY OF CHAR; i: INTEGER; size: LONGINT);
- BEGIN
- END DoNotShowLevels;
-
- PROCEDURE DummyAllocInfo(pBefore, pAfter: ADDRESS; size: LONGINT; lev: INTEGER);
- BEGIN
- END DummyAllocInfo;
-
- PROCEDURE DummyDeallocInfo(pBefore, pAfter: ADDRESS; lev: INTEGER);
- BEGIN
- END DummyDeallocInfo;
-
-
- BEGIN
- (* debugging *) lastModuleID:= 'DMHeapWatch';
- (* debugging *) Message("Initializing DMHeapWatch","");
- ptrCount := 0;
- handleCount := 0;
- windowCount := 0; controlCount := 0; TECount := 0;
- menuCount := 0; dialogCount := 0;
- showLevels := DoNotShowLevels;
- debugProc := DoNotShowLevels;
- allocInfoProc := DummyAllocInfo ;
- deallocInfoProc := DummyDeallocInfo ;
- InstallTermProc(AtTermDM, initTermDone);
- IF NOT initTermDone THEN HALT END;
- FOR i:= 0 TO maxBlocks DO
- blockSizes[i] := 0D;
- END(*FOR*);
- END DMHeapWatch .
-